 <template>
  <div>
    <div class="banner" @click="handleGallaryClick">
      <img class="banner-img" :src="bannerImg" />
      <div class="info">
        <div class="info-title">{{sightName}}</div>
        <div class="info-number">
          <div class="iconfont img-icon">&#59286; {{this.gallaryImgs.length}}</div>
        </div>
      </div>
    </div>
    <fade-animation>
      <common-gallary
        v-show="gallaryShow"
        @gallaryClose="handleGallaryClose"
        :imgList="gallaryImgs"
      ></common-gallary>
    </fade-animation>
  </div>
</template>

<script>
import commonGallary from 'common/gallary/Gallary'
import FadeAnimation from 'common/fade/FadeAnimation'
export default {
  name: 'Banner',
  props: {
    sightName: String,
    bannerImg: String,
    gallaryImgs: Array
  },
  data () {
    return {
      gallaryShow: false
    }
  },
  methods: {
    handleGallaryClick () {
      this.gallaryShow = true
    },
    handleGallaryClose () {
      this.gallaryShow = false
    }
  },
  components:
  {
    commonGallary,
    FadeAnimation
  }
}
</script>

<style lang="stylus" scoped>
.banner {
  position: relative;
  overflow: hidden;
  height: 0;
  padding-bottom: 55%;

  .banner-img {
    width: 100%;
  }

  .info {
    display: flex;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    line-height: 0.6rem;
    color: #fff;
    background: linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 1));

    .info-title {
      flex: 1;
      font-size: 0.32rem;
      padding: 0 0.2rem;
    }

    .info-number {
      margin: 0.14rem 0.14rem 0 0;
      padding: 0 0.24rem;
      height: 0.32rem;
      line-height: 0.32rem;
      border-radius: 0.2rem;
      background: rgba(0, 0, 0, 0.8);
      font-size: 0.24rem;

      .img-icon {
        font-size: 0.24rem;
      }
    }
  }
}
</style>
